package com.gywj.race.controller.api;

import com.gywj.race.config.result.AjaxResultHandler;
import com.gywj.race.entity.Organizer;
import com.gywj.race.service.OrganizerService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * The type Organizer controller.
 */
@RestController
public class OrganizerController {
    @Resource
    private OrganizerService organizerService;

    /**
     * Gets organizer list.
     *
     * @return the organizer list
     */
    @PostMapping("/organizer/list")
    public Map<String, Object> getOrganizerList() {
        try {
            List<Organizer> eventOrganizer = organizerService.getOrganizerList();
            return AjaxResultHandler.Success("成功", eventOrganizer);
        } catch (Exception e) {
            return AjaxResultHandler.Failed(e.getMessage());
        }
    }
}
